import Vue from 'vue';
import VueRouter from 'vue-router';
import index from '../views/index.vue';
import login from '../views/login.vue';
import forgot from '../views/forgot.vue';
import register from '../views/register.vue';
Vue.use(VueRouter)

const routes = [
	// 主页
	{
		path: '/',
		name: 'index',
		component: index,
		meta: {
			index: 0,
			title: '首页'
		}
	},

	// 登录
	{
		path: '/login',
		name: 'login',
		component: login,
		meta: {
			index: 0,
			title: '登录'
		}
	},
	// 注册
	{
		path: '/register',
		name: 'register',
		component: register,
		meta: {
			index: 0,
			title: '注册'
		}
	},

	// 忘记密码
	{
		path: '/forgot',
		name: "forgot",
		component: forgot,
		meta: {
			index: 0,
			title: '忘记密码'
		}
	},

	// 修改密码
	{
		path: '/user/password',
		name: "password",
		component: () => import("../views/user/password.vue"),
		meta: {
			index: 0,
			title: '修改密码'
		}
	},
	{
		path: '/admin/userBinli',
		name: 'userBinli',
		component: () => import('../views/admin/userBinli.vue')
	}

	// 视频播放页
	// {
	// 	path: "/media/video",
	// 	name: "video",
	// 	component: () => import('../views/media/video.vue'),
	// 	meta: {
	// 		index: 0,
	// 		title: "视频"
	// 	}
	// },

	// // 音频播放页
	// {
	// 	path: "/media/audio",
	// 	name: "audio",
	// 	component: () => import('../views/media/audio.vue'),
	// 	meta: {
	// 		index: 0,
	// 		title: "音频"
	// 	}
	// },
	// // 患者路由
	// {
	// 	path: '/patient/table',
	// 	name: 'patient_table',
	// 	component: () => import('../views/patient/table.vue')
	// },
	// {
	// 	path: '/patient/view',
	// 	name: 'patient_view',
	// 	component: () => import('../views/patient/view.vue')
	// },
	// // 医生路由
	// {
	// 	path: '/doctor/table',
	// 	name: 'doctor_table',
	// 	component: () => import('../views/doctor/table.vue')
	// },
	// {
	// 	path: '/doctor/view',
	// 	name: 'doctor_view',
	// 	component: () => import('../views/doctor/view.vue')
	// },
	// // 护士路由
	// {
	// 	path: '/nurse/table',
	// 	name: 'nurse_table',
	// 	component: () => import('../views/nurse/table.vue')
	// },
	// {
	// 	path: '/nurse/view',
	// 	name: 'nurse_view',
	// 	component: () => import('../views/nurse/view.vue')
	// },
	// // 监督员路由
	// {
	// 	path: '/supervisor/table',
	// 	name: 'supervisor_table',
	// 	component: () => import('../views/supervisor/table.vue')
	// },
	// {
	// 	path: '/supervisor/view',
	// 	name: 'supervisor_view',
	// 	component: () => import('../views/supervisor/view.vue')
	// },
	// // 财务路由
	// {
	// 	path: '/finance/table',
	// 	name: 'finance_table',
	// 	component: () => import('../views/finance/table.vue')
	// },
	// {
	// 	path: '/finance/view',
	// 	name: 'finance_view',
	// 	component: () => import('../views/finance/view.vue')
	// },
	// // 前台人员路由
	// {
	// 	path: '/front_desk_staff/table',
	// 	name: 'front_desk_staff_table',
	// 	component: () => import('../views/front_desk_staff/table.vue')
	// },
	// {
	// 	path: '/front_desk_staff/view',
	// 	name: 'front_desk_staff_view',
	// 	component: () => import('../views/front_desk_staff/view.vue')
	// },
	// // 患者信息路由
	// {
	// 	path: '/patient_information/table',
	// 	name: 'patient_information_table',
	// 	component: () => import('../views/patient_information/table.vue')
	// },
	// {
	// 	path: '/patient_information/view',
	// 	name: 'patient_information_view',
	// 	component: () => import('../views/patient_information/view.vue')
	// },
	// // 项目检查路由
	// {
	// 	path: '/project_inspection/table',
	// 	name: 'project_inspection_table',
	// 	component: () => import('../views/project_inspection/table.vue')
	// },
	// {
	// 	path: '/project_inspection/view',
	// 	name: 'project_inspection_view',
	// 	component: () => import('../views/project_inspection/view.vue')
	// },
	// // 检查结果路由
	// {
	// 	path: '/inspection_results/table',
	// 	name: 'inspection_results_table',
	// 	component: () => import('../views/inspection_results/table.vue')
	// },
	// {
	// 	path: '/inspection_results/view',
	// 	name: 'inspection_results_view',
	// 	component: () => import('../views/inspection_results/view.vue')
	// },
	// // 诊疗结果路由
	// {
	// 	path: '/diagnosis_and_treatment_results/table',
	// 	name: 'diagnosis_and_treatment_results_table',
	// 	component: () => import('../views/diagnosis_and_treatment_results/table.vue')
	// },
	// {
	// 	path: '/diagnosis_and_treatment_results/view',
	// 	name: 'diagnosis_and_treatment_results_view',
	// 	component: () => import('../views/diagnosis_and_treatment_results/view.vue')
	// },
	// // 项目费用路由
	// {
	// 	path: '/project_cost/table',
	// 	name: 'project_cost_table',
	// 	component: () => import('../views/project_cost/table.vue')
	// },
	// {
	// 	path: '/project_cost/view',
	// 	name: 'project_cost_view',
	// 	component: () => import('../views/project_cost/view.vue')
	// },
	// // 诊疗费用路由
	// {
	// 	path: '/diagnosis_and_treatment_expenses/table',
	// 	name: 'diagnosis_and_treatment_expenses_table',
	// 	component: () => import('../views/diagnosis_and_treatment_expenses/table.vue')
	// },
	// {
	// 	path: '/diagnosis_and_treatment_expenses/view',
	// 	name: 'diagnosis_and_treatment_expenses_view',
	// 	component: () => import('../views/diagnosis_and_treatment_expenses/view.vue')
	// },
	// // 住院办理路由
	// {
	// 	path: '/hospitalization_handling/table',
	// 	name: 'hospitalization_handling_table',
	// 	component: () => import('../views/hospitalization_handling/table.vue')
	// },
	// {
	// 	path: '/hospitalization_handling/view',
	// 	name: 'hospitalization_handling_view',
	// 	component: () => import('../views/hospitalization_handling/view.vue')
	// },
	// // 护理信息路由
	// {
	// 	path: '/nursing_information/table',
	// 	name: 'nursing_information_table',
	// 	component: () => import('../views/nursing_information/table.vue')
	// },
	// {
	// 	path: '/nursing_information/view',
	// 	name: 'nursing_information_view',
	// 	component: () => import('../views/nursing_information/view.vue')
	// },
	// // 住院会诊路由
	// {
	// 	path: '/inpatient_consultation/table',
	// 	name: 'inpatient_consultation_table',
	// 	component: () => import('../views/inpatient_consultation/table.vue')
	// },
	// {
	// 	path: '/inpatient_consultation/view',
	// 	name: 'inpatient_consultation_view',
	// 	component: () => import('../views/inpatient_consultation/view.vue')
	// },
	// // 出院结算路由
	// {
	// 	path: '/discharge_settlement/table',
	// 	name: 'discharge_settlement_table',
	// 	component: () => import('../views/discharge_settlement/table.vue')
	// },
	// {
	// 	path: '/discharge_settlement/view',
	// 	name: 'discharge_settlement_view',
	// 	component: () => import('../views/discharge_settlement/view.vue')
	// },
	// // 出院办理路由
	// {
	// 	path: '/discharge_handling/table',
	// 	name: 'discharge_handling_table',
	// 	component: () => import('../views/discharge_handling/table.vue')
	// },
	// {
	// 	path: '/discharge_handling/view',
	// 	name: 'discharge_handling_view',
	// 	component: () => import('../views/discharge_handling/view.vue')
	// },
	// // 转院办理路由
	// {
	// 	path: '/transfer_to_another_hospital/table',
	// 	name: 'transfer_to_another_hospital_table',
	// 	component: () => import('../views/transfer_to_another_hospital/table.vue')
	// },
	// {
	// 	path: '/transfer_to_another_hospital/view',
	// 	name: 'transfer_to_another_hospital_view',
	// 	component: () => import('../views/transfer_to_another_hospital/view.vue')
	// },
	// // 会诊结果路由
	// {
	// 	path: '/consultation_results/table',
	// 	name: 'consultation_results_table',
	// 	component: () => import('../views/consultation_results/table.vue')
	// },
	// {
	// 	path: '/consultation_results/view',
	// 	name: 'consultation_results_view',
	// 	component: () => import('../views/consultation_results/view.vue')
	// },
	// // 通知消息路由
	// {
	// 	path: '/notification_message/table',
	// 	name: 'notification_message_table',
	// 	component: () => import('../views/notification_message/table.vue')
	// },
	// {
	// 	path: '/notification_message/view',
	// 	name: 'notification_message_view',
	// 	component: () => import('../views/notification_message/view.vue')
	// },
	// // 投诉建议路由
	// {
	// 	path: '/complaints_and_suggestions/table',
	// 	name: 'complaints_and_suggestions_table',
	// 	component: () => import('../views/complaints_and_suggestions/table.vue')
	// },
	// {
	// 	path: '/complaints_and_suggestions/view',
	// 	name: 'complaints_and_suggestions_view',
	// 	component: () => import('../views/complaints_and_suggestions/view.vue')
	// },

	// // 用户路由
	// {
	// 	path: '/user/table',
	// 	name: 'user_table',
	// 	component: () => import('../views/user/table.vue'),
	// 	meta: {
	// 		index: 0,
	// 		title: '用户列表'
	// 	}
	// },
	// {
	// 	path: '/user/view',
	// 	name: 'user_view',
	// 	component: () => import('../views/user/view.vue'),
	// 	meta: {
	// 		index: 0,
	// 		title: '用户详情'
	// 	}
	// },
	// {
	// 	path: '/user/info',
	// 	name: 'user_info',
	// 	component: () => import('../views/user/info.vue'),
	// 	meta: {
	// 		index: 0,
	// 		title: '个人信息'
	// 	}
	// },
	// // 用户组路由
	// {
	// 	path: '/user_group/table',
	// 	name: 'user_group_table',
	// 	component: () => import('../views/user_group/table.vue'),
	// 	meta: {
	// 		index: 0,
	// 		title: '用户组列表'
	// 	}
	// },
	// {
	// 	path: '/user_group/view',
	// 	name: 'user_group_view',
	// 	component: () => import('../views/user_group/view.vue'),
	// 	meta: {
	// 		index: 0,
	// 		title: '用户组详情'
	// 	}
	// }
]

const router = new VueRouter({
	mode: 'history',
	base: process.env.BASE_URL,
	routes
})

router.beforeEach((to, from, next) => {
	let token = to.query.token;
	if (token){
		$.db.set("token",token,120);
	}
	next();
})

router.afterEach((to, from, next) => {
	let title = "医院电子病历管理系统-admin";
	document.title = title;
})

export default router
